package com.wfs.spring.thread.Thread;

/**
 * @Auther: wfs
 * @Date: 2019/6/13 20:15
 * @Description:
 */
public class ThreadA extends Thread {
    private Object object;

    public ThreadA( Object object) {
        this.object = object;
    }

    @Override
    public void run() {
       try {
           synchronized (object){
             /*  for (int i=1;i<10;i++){
                   System.out.println("sssss:"+i);
                   Thread.sleep(1000);
                  // yield();
               }*/
           if (MyList.size()!=5){
               System.out.println("开始 wait time="+System.currentTimeMillis());
               object.wait(1000);
               System.out.println("结束 wait time="+System.currentTimeMillis());
           }
           }
       }catch (Exception e){
           e.printStackTrace();
       }
    }
}
